<template>
  <view>
    <view class="login_top">
      <view class="text_c">账号登录</view>

      <view class="text_r">
        <view class="text-pic">手机号登录</view>
        <image src="../../static/image/lujin.png" mode="aspectFill"></image>
      </view>
    </view>
    <u--input class="input_s" placeholder="请输入手机号" border="bottom" clearable v-model="account"></u--input>
    <u--input class="input_p" placeholder="请输入密码" border="bottom" type="password" clearable v-model="password" suffixIcon="eye-fill"></u--input>
    <u-button class="btn" type="error" style="width: 309px;" @click="submit">登录</u-button>
  </view>
</template>

<script>
import code from '../../uni_modules/uview-ui/libs/config/props/code';
export default {
  name: 'namePages',
  components: {},
  data() {
    return {
      account: 'hdsj001',
      token: '',
      password: '123456'
    };
  },
  created() {},
  mounted() {},
  onLoad() {},
  methods: {
    async submit() {
      let {
        data: { data }
      } = await uni.$http.post('/login/account', {
        account: this.account,
        password: this.password
      });
      console.log(data);
      this.token = data;
      uni.setStorageSync('token', this.token);
      
        uni.switchTab({
          url: '/pages/index/index'
        });
      
    }
  }
};
</script>

<style lang="scss">
.login_top {
  display: flex;

  color: #2a2929;

  .text_c {
    font-size: 24px;
    margin: 30px 90px 45.5px 32px;
    font-weight: 600;
  }

  .text_r {
    display: flex;
    margin-right: 34px;
    .text-pic {
      font-size: 16px;
      width: 80px;
      height: 22px;
      margin: 36px 3px 0 0;
      color: #ef4f3f;
    }
    image {
      width: 10px;
      height: 10px;
      margin-top: 43px;
    }
  }
}
u-line {
  margin: 0 33px;
}
.input_s,
.input_p {
  margin: 10px 33px;
}

.btn {
  margin-top: 60px;
  border-radius: 24px;
}
</style>
